﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace OrderWebApplication.Models {
    public class OrderDetail {
        private int orderDetailId;
        private Commodity commodity;
        private int amount = 0;

        public int OrderDetailId { get => orderDetailId; set => orderDetailId = value; }
        public int Amount { get => amount; set => amount = value; }
        public Commodity Commodity { get => commodity; set => commodity = value; }
        public double Price { get => commodity.UnitPrice * amount; }

        public OrderDetail() { }
        public OrderDetail(Commodity commodity, int amount) {
            this.Commodity = commodity;
            this.Amount = amount;
        }
    }
}
